package circular_buffer;

import java.util.LinkedList;

public abstract class AbstractCircularBuffer<T> implements CircularBuffer<T> {
	protected int maxSize;
	protected LinkedList<T> buffer=new LinkedList<T>();
	
	public abstract void put(T elem);
	public abstract T get();
	
	public synchronized int size() {
		return buffer.size();
	}
	public boolean isEmpty() {
		return size()==0;
	}
	public boolean isFull() {
		return size()==maxSize;
	}
	protected int getNextIndex(int index) {
		return (index+1)%maxSize;
	}
}
